package com.meibao.order.client;

import com.meibao.order.dto.AddressDTO;

import java.util.ArrayList;
import java.util.List;

public abstract class AddressClient {
    public static final List<AddressDTO> addressList = new ArrayList<AddressDTO>(){
        {
            AddressDTO address = new AddressDTO();
            address.setId(1L);
            address.setAddress("体育西路西雅苑天英阁2802号");
            address.setCity("广州市");
            address.setDistrict("天河区");
            address.setName("杨秀青");
            address.setPhone("13731254802");
            address.setState("广东省");
            address.setZipCode("510630");
            address.setIsDefault(true);
            add(address);

            AddressDTO address2 = new AddressDTO();
            address2.setId(2L);
            address2.setAddress("五四路康乐家园3号楼");
            address2.setCity("保定市");
            address2.setDistrict("竞秀区");
            address2.setName("杨秀青");
            address2.setPhone("18735121775");
            address2.setState("河北省");
            address2.setZipCode("071000");
            address2.setIsDefault(false);
            add(address2);
        }
    };

    public static AddressDTO findById(Long id){
        for (AddressDTO addressDTO : addressList) {
            if(addressDTO.getId() == id) return addressDTO;
        }
        return null;
    }
}

